import java.util.Collections;


class ABTreeLeaf extends ABTreeNode {

	int value;

	ABTreeLeaf(ABTreeInnerNode parent, int value) {
		this.value = value;
		this.parent = parent;
	}

	@Override
	int getLowestKey() {
		return value;
	}

	@Override
	void insert(int value) {
		ABTreeLeaf leaf = new ABTreeLeaf(parent, value);
		parent.children.add(leaf);
		Collections.sort(parent.children);
	}

	@Override
	void remove(int value) {
		if (this.value != value)
			return;
		parent.children.remove(this);
	}

	@Override
	public boolean equals(Object obj) {
		if (obj.getClass() != ABTreeLeaf.class)
			return false;
		ABTreeLeaf rhs = (ABTreeLeaf) obj;
		return value == rhs.value;
	}

	void print() {
		System.out.print("(" + value + ")");
	}
}
